package com.ad_hccm.service.impl.Week;

import com.ad_hccm.dao.Week.RecrudescenceEvaluateDao;
import com.ad_hccm.domain.Week.RecrudescenceEvaluate;
import com.ad_hccm.domain.Week.RecrudescenceInducingFactors;
import com.ad_hccm.service.Week.RecrudescenceEvaluateService;
import com.ad_hccm.service.Week.RecrudescenceInducingFactorsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;

/**
 * TODO 复发评定
 */
@Service
public class RecrudescenceEvaluateServiceImpl implements RecrudescenceEvaluateService {
    @Autowired
    private RecrudescenceEvaluateDao dao;

    @Autowired
    private RecrudescenceInducingFactorsService recrudescenceInducingFactorsService;

    @Override
    public boolean save(RecrudescenceEvaluate domain) {
        domain.setDate(new Date((System.currentTimeMillis())));
        RecrudescenceInducingFactors recrudescenceInducingFactors = new RecrudescenceInducingFactors();
        recrudescenceInducingFactors.setId(domain.getId());
        recrudescenceInducingFactors.setWeek(domain.getWeek());
        recrudescenceInducingFactors.setDate(domain.getDate());
        recrudescenceInducingFactorsService.save(recrudescenceInducingFactors);
        return dao.save(domain);
    }

    @Override
    public boolean update(RecrudescenceEvaluate domain) {
        return dao.update(domain);
    }

    @Override
    public List<RecrudescenceEvaluate> getById(String id) {
        return dao.getById(id);
    }

    @Override
    public List<RecrudescenceEvaluate> getAll() {
        return dao.getAll();
    }

    @Override
    public List<RecrudescenceEvaluate> getBigDate(String id, Date date) {
        return dao.getBigDate(id,date);
    }
}
